/*
 * GL3DTest.hpp
 *
 *  Created on: Aug 10, 2012
 *      Author: Scorpion
 */

#ifndef GL3DTEST_HPP_
#define GL3DTEST_HPP_
#include "GL2DTest.hpp"
#include <math.h>
void display3d() {
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0f, 0.0f, 0.0f);
	glTranslatef(100.0, 100.0, 0.0f);
	glutSolidSphere(100, 50, 50);
	glBegin(GL_LINE_LOOP);
	for (float v = 0.0; v < 2 * 3.14; v += 0.1) {
		glVertex2f(150 + 100 * cos(v), 150 + 100 * sin(v));
	}
	glEnd();
	glFlush();
}
void init3d() {
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0, WIN_W, 0.0, WIN_H, 0.0, WIN_H);
	glViewport(0, 0, WIN_W, WIN_H);
}
int main3d(int argc, char** argv) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(WIN_W, WIN_H);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("simple");
	glutDisplayFunc(display3d);
	init3d();
	const GLubyte* version = glGetString(GL_VERSION);
	printf("the current OpenGL version:%s\n", version);
	glutMainLoop();
	return 0;
}
int gl3dmain(int argc, char** argv) {
	main3d(argc, argv);
	return 0;
}
#endif /* GL3DTEST_HPP_ */
